<template>
  <div class="container">
    <router-view
      :co-list="CoList"
      @collection="collection"
      :sz-list="szList"
      @upload="upload"
      :load-list="loadList"
    ></router-view>
  </div>
</template>

<script>
import { getcolist } from "./api/home";
export default {
  data() {
    return {
      szList: [],
      CoList: null,
      loadList: [],
    };
  },
  methods: {
    collection({ lists, id }) {
      if (lists != null) {
        this.szList = [...this.szList, lists];
      } else {
        let index = this.szList.findIndex((item) => item.id == id);
        this.szList.splice(index, 1);
      }
    },
    upload({ uploadList }) {
      if (uploadList != null) {
        this.loadList = [...this.loadList, uploadList];
      }
    },
  },
  created() {
    getcolist().then((data) => {
      this.CoList = data.data;
      // console.log(this.CoList);
    });
  },
};
</script>

<style lang="scss" scoped>
// 公共css
@import "./assets/css/index.css";
</style>
